bitkeeper revision 1.1236.31.6 (4238d3ac4pKI7cNlIOkb6jQx5kNtUA)
authordjm@kirby.fc.hp.com <djm@kirby.fc.hp.com>
Thu, 17 Mar 2005 00:47:40 +0000 (00:47 +0000)
committerdjm@kirby.fc.hp.com <djm@kirby.fc.hp.com>
Thu, 17 Mar 2005 00:47:40 +0000 (00:47 +0000)
Fix "timer tick before its due"

xen/arch/ia64/vcpu.c
xen/include/asm-ia64/config.h

index f37aa1ab279c2caa2f669612512fdb0efcdc3a9a..86981677125dce5d661d9afa34c9ee403e549b87 100644 (file)
@@ -511,6 +511,13 @@ void vcpu_pend_interrupt(VCPU *vcpu, UINT64 vector)
        set_bit(vector,PSCB(vcpu,irr));
 }
 
+void early_tick(VCPU *vcpu)
+{
+       UINT64 *p = &PSCB(vcpu,irr[3]);
+       printf("vcpu_check_pending: about to deliver early tick\n");
+       printf("&irr[0]=%p, irr[0]=0x%lx\n",p,*p);
+}
+
 #define        IA64_TPR_MMI    0x10000
 #define        IA64_TPR_MIC    0x000f0
 
@@ -563,6 +570,14 @@ UINT64 vcpu_check_pending_interrupts(VCPU *vcpu)
        }
 
 //printf("returned to caller\n");
+#if 0
+if (vector == (PSCB(vcpu,itv) & 0xff)) {
+       UINT64 now = ia64_get_itc();
+       UINT64 itm = PSCB(vcpu,domain_itm);
+       if (now < itm) early_tick(vcpu);
+       
+}
+#endif
        return vector;
 }
 
@@ -815,14 +830,21 @@ BOOLEAN vcpu_timer_disabled(VCPU *vcpu)
        return(!itv || !!(itv & 0x10000));
 }
 
+BOOLEAN vcpu_timer_inservice(VCPU *vcpu)
+{
+       UINT64 itv = PSCB(vcpu,itv);
+       return (test_bit(itv, PSCB(vcpu,insvc)));
+}
+
 BOOLEAN vcpu_timer_expired(VCPU *vcpu)
 {
        unsigned long domain_itm = PSCB(vcpu,domain_itm);
        unsigned long now = ia64_get_itc();
  
-       if (domain_itm && (now > domain_itm) &&
-               !vcpu_timer_disabled(vcpu)) return TRUE;
-       return FALSE;
+       if (!domain_itm) return FALSE;
+       if (now < domain_itm) return FALSE;
+       if (vcpu_timer_disabled(vcpu)) return FALSE;
+       return TRUE;
 }
 
 void vcpu_safe_set_itm(unsigned long val)
@@ -956,6 +978,7 @@ void vcpu_pend_timer(VCPU *vcpu)
        UINT64 itv = PSCB(vcpu,itv) & 0xff;
 
        if (vcpu_timer_disabled(vcpu)) return;
+       if (vcpu_timer_inservice(vcpu)) return;
 #if 1
        // attempt to flag "timer tick before its due" source
        {
@@ -1071,6 +1094,7 @@ while(1);
 
 IA64FAULT vcpu_cover(VCPU *vcpu)
 {
+       // TODO: Only allowed for current vcpu
        REGS *regs = vcpu_regs(vcpu);
 
        if (!PSCB(vcpu,interrupt_collection_enabled)) {
@@ -1229,6 +1253,7 @@ IA64FAULT vcpu_get_pmd(VCPU *vcpu, UINT64 reg, UINT64 *pval)
 
 IA64FAULT vcpu_bsw0(VCPU *vcpu)
 {
+       // TODO: Only allowed for current vcpu
        REGS *regs = vcpu_regs(vcpu);
        unsigned long *r = &regs->r16;
        unsigned long *b0 = &PSCB(vcpu,bank0_regs[0]);
@@ -1244,6 +1269,7 @@ IA64FAULT vcpu_bsw0(VCPU *vcpu)
 
 IA64FAULT vcpu_bsw1(VCPU *vcpu)
 {
+       // TODO: Only allowed for current vcpu
        REGS *regs = vcpu_regs(vcpu);
        unsigned long *r = &regs->r16;
        unsigned long *b0 = &PSCB(vcpu,bank0_regs[0]);
@@ -1535,6 +1561,7 @@ IA64FAULT vcpu_ptc_l(VCPU *vcpu, UINT64 vadr, UINT64 addr_range)
 // on the physical address, which is guaranteed to flush the same cache line
 IA64FAULT vcpu_fc(VCPU *vcpu, UINT64 vadr)
 {
+       // TODO: Only allowed for current vcpu
        UINT64 mpaddr, ps;
        IA64FAULT fault;
        unsigned long match_dtlb(VCPU *, unsigned long, unsigned long *, unsigned long *);
index ed6568bc0912a0fdeceeb021b4b73a33fbfcf64a..597654396a20f7e08a395f36aaf84c8168c0440e 100644 (file)
@@ -1,6 +1,6 @@
 // control flags for turning on/off features under test
 #undef CLONE_DOMAIN0
-//#define CLONE_DOMAIN0 1
+//#define CLONE_DOMAIN0 5
 
 // manufactured from component pieces